﻿<local:TWPage
    x:Class="metroCIS.Win8Application.Views.Overview"
    IsTabStop="false"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:view="using:metroCIS.ViewModel"
    xmlns:local="using:metroCIS.Win8Application.Views"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">
    <ItemsControl>
        <ItemsControl.ItemsPanel>
            <ItemsPanelTemplate>
                <StackPanel Orientation="Horizontal" />
            </ItemsPanelTemplate>
        </ItemsControl.ItemsPanel>

        <Border Margin="40" BorderBrush="{StaticResource twGreen}" BorderThickness="1">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="0.7*"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*"/>     
                </Grid.RowDefinitions>
                
                <Image Stretch="UniformToFill" Source="../Images/Overview.jpg" Grid.ColumnSpan="2" Grid.RowSpan="3"/>
                
                <StackPanel Grid.RowSpan="2" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="40" Visibility="{Binding NextLesson,Converter={StaticResource IsNullToVisibility}}">
                    <TextBlock Margin="3" FontSize="20" Text="Nächste Lehrveranstaltung" FontWeight="Bold"/>
                    <TextBlock FontSize="16" Margin="3" Text="{Binding NextLesson.Title}"/>
                    <TextBlock FontSize="16" Margin="3" Text="{Binding NextLesson.Room}"/>
                    <StackPanel Orientation="Horizontal" Grid.Row="3">
                        <TextBlock FontSize="16" Margin="3" Text="{Binding NextLesson.From,Converter={StaticResource StringConverter},ConverterParameter='t'}"/>
                        <TextBlock FontSize="16" Margin="0,3,0,3" Text=" - "/>
                        <TextBlock FontSize="16" Margin="3" Text="{Binding NextLesson.To,Converter={StaticResource StringConverter},ConverterParameter='t'}"/>
                    </StackPanel>
                </StackPanel>
                
                <Border Grid.Column="1" Grid.Row="0" Background="{StaticResource twGreen}">
                    <TextBlock Style="{StaticResource PageHeaderTextStyle}" Text="Neuigkeiten" FontSize="38" Margin="8" Foreground="White" />
                </Border>
                
                <ListBox Width="500" Margin="-2" Grid.Row="1" Grid.Column="1" ItemsSource="{Binding RssItems}">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                </Grid.RowDefinitions>
                                <StackPanel Orientation="Horizontal">
                                    <Image Height="16" Margin="3" VerticalAlignment="Center" Source="../Images/rss.gif" />
                                    <TextBlock Margin="3" VerticalAlignment="Center" FontSize="13" FontWeight="Bold" Grid.Row="0" Text="{Binding Title}" />
                                </StackPanel>
                                <TextBlock Grid.Row="1" Text="{Binding Description}" TextWrapping="Wrap" TextTrimming="WordEllipsis" />
                            </Grid>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </Grid>
        </Border>

        <GridView
                Margin="40"
                Grid.Row="1"
                x:Name="_mainGridView"
                SelectionMode="None"
                ItemClick="_mainGridView_ItemClick"
                IsItemClickEnabled="True">
            <GridView.ItemTemplate>
                <DataTemplate>
                    <Border BorderBrush="{StaticResource twGreen}" BorderThickness="1">
                        <Grid Width="500" Height="250">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="60"/>
                            </Grid.RowDefinitions>
                            <Image Opacity="0.8"  Stretch="UniformToFill"  Grid.Row="0" Source="{Binding Image}"/>
                            <Border Grid.Row="1" Background="{StaticResource twGreen}">
                                <TextBlock VerticalAlignment="Center"  Margin="10" Foreground="White" FontWeight="Bold"  Text="{Binding Title}"/>
                            </Border>
                        </Grid>
                    </Border>
                </DataTemplate>
            </GridView.ItemTemplate>

            <GridView.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapGrid  />
                </ItemsPanelTemplate>
            </GridView.ItemsPanel>
        </GridView>
        
    </ItemsControl>
</local:TWPage>